<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./js/echarts.min.js"></script>
  </head>
  <body>
    <!-- 为 ECharts 准备一个定义了宽高的 DOM -->
    <div id="main" style="width: 800px; height: 800px"></div>
    <script type="text/javascript">
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById("main"));

      // 指定图表的配置项和数据
      option = {
        title: [
          {
            text: "男女薪资分布",
            left: "5%",
          },
          {
            subtext: "男生",
            left: " 50%",
            top: "45%",
            textAlign: "center",
            subtextStyle: {
              fontSize: 20,
              color: "black",
            },
          },
          {
            subtext: "女生",
            left: "50%",
            bottom: "0%",
            textAlign: "center",
            subtextStyle: {
              fontSize: 20,
              color: "black",
            },
          },
        ],
        tooltip: {
          trigger: "item",
        },

        series: [
          {
            width: "50%",
            center: ["100%", "23%"],
            name: "Access From",
            type: "pie",
            radius: ["50%", "70%"],
            data: [
              { value: 1048, name: "1万以下" },
              { value: 735, name: "2万以上" },
              { value: 580, name: "1-1.5万" },
              { value: 484, name: "1.5-2万" },
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
          },
          {
            subtext: "女生",
            width: "50%",
            center: ["100%", "72%"],
            name: "Access From",
            type: "pie",
            radius: ["50%", "70%"],

            data: [
              { value: 300, name: "1万以下" },
              { value: 735, name: "2万以上" },
              { value: 266, name: "1-1.5万" },
              { value: 696, name: "1.5-2万" },
            ],
            emphasis: {
              itemStyle: {
                shadowBlur: 10,
                shadowOffsetX: 0,
                shadowColor: "rgba(0, 0, 0, 0.5)",
              },
            },
          },
        ],
      };

      myChart.setOption(option);
      // 使用刚指定的配置项和数据显示图表。
    </script>
  </body>
</html>
